<template>
  <div class="home">
    <div class="swiper mySwiper">
      <div class="swiper-wrapper">
        <div class="swiper-slide">
          <img src="./images/3.jpg" alt="" />
        </div>
        <div class="swiper-slide">
          <img src="./images/1.jpg" alt="" />
        </div>
        <div class="swiper-slide">
          <img src="./images/2.jpg" alt="" />
        </div>
        <div class="swiper-slide">
          <img src="./images/5.jpg" alt="" />
        </div>
        <div class="swiper-slide">
          <img src="./images/4.jpg" alt="" />
        </div>
      </div>
      <div class="swiper-button-next"></div>
      <div class="swiper-button-prev"></div>
      <div class="swiper-pagination"></div>
    </div>
    <div class="container">
      <div class="title">
        <div class="left">
          <div class="newGg">
            <i><img src="./images/公告.png" alt="" /></i>
            <a href="#"
              >最新公告：<strong>阿巴阿巴控股第666届董事会议...</strong></a
            >
          </div>
          <span>2022/8/11</span>
          <strong>股票代码：666666</strong>
        </div>
        <div class="right">
          <div class="before">
            <div class="box">
              <p>6.6</p>
              <img src="./images/向上.png" alt="" />
            </div>

            <span>2022/8/11</span>
          </div>
          <div class="after">
            <p>1.66%</p>
            <span> {{ timeDate | formatDate }} (北京时间)</span>
          </div>
        </div>
      </div>
      <div class="content">
        <div class="tite">
          <div class="box">
            <i class="iconfont icon-anli"></i>
            <span>销售案例</span>
          </div>
          <span>查看更多 > </span>
        </div>
        <div class="bottom">
          <div class="box">
            <img src="./images/01.jpg" alt="" />
            <p>380 Lonsdale St 精品...</p>
            <p>
              约 ￥ 367万元
              <span><em class="iconfont icon-dingwei"></em>挪威</span>
            </p>
          </div>
          <div class="box">
            <img src="./images/02.jpg" alt="" />
            <p>NEUE Macquarie Park...</p>
            <p>
              约 ￥ 666万元
              <span><em class="iconfont icon-dingwei"></em>瑞士</span>
            </p>
          </div>
          <div class="box">
            <img src="./images/03.jpg" alt="" />
            <p>【南半球地标】澳洲...</p>
            <p>
              约 ￥ 401万元
              <span><em class="iconfont icon-dingwei"></em>澳大利亚</span>
            </p>
          </div>
          <div class="box">
            <img src="./images/04.png" alt="" />
            <p>The Neue 芬兰公寓</p>
            <p>
              拼夕夕已砍
              <span><em class="iconfont icon-dingwei"></em>未知地</span>
            </p>
          </div>
        </div>
      </div>
    </div>
    <el-tooltip
    
      class="item"
      effect="dark"
      content="Top Left 提示文字"
      placement="left-start"
    >
      <template #content>
        返回顶部
      </template>
      <el-button class="iconfont icon-fanhuidingbu"></el-button>
    </el-tooltip>
  </div>
</template>

<script>
import Swiper from "swiper";
import "swiper/dist/css/swiper.min.css";
// import "swiper/swiper.min.css";

var formatNum = function (num) {
  return num < 10 ? "0" + num : num;
};

export default {
  name: "MyHome",
  mounted() {
    new Swiper(".swiper", {
      // Optional parameters
      loop: true,
      autoplay: {
        delay: 2000,
        stopOnLastSlide: false,
        disableOnInteraction: true,
      },
      // If we need pagination
      pagination: {
        el: ".swiper-pagination",
      },

      // Navigation arrows
      navigation: {
        nextEl: ".swiper-button-next",
        prevEl: ".swiper-button-prev",
      },

      // And if we need scrollbar
      scrollbar: {
        el: ".swiper-scrollbar",
      },
    });
    // 实时-时间-计时
    var that = this;
    var timer = setInterval(function () {
      that.timeDate = new Date();
    }, 1000);
    console.log(timer);
  },
  data() {
    return {
      timeDate: new Date(),
    };
  },

  filters: {
    // 实时-时间-数据转换
    formatDate(value) {
      var year = value.getFullYear();
      var month = formatNum(value.getMonth() + 1);
      var day = formatNum(value.getDate());
      var hour = formatNum(value.getHours());
      var min = formatNum(value.getMinutes());
      var sec = formatNum(value.getSeconds());
      return (
        year + "-" + month + "-" + day + " " + hour + ":" + min + ":" + sec
      );
    },
  },
  // 实时-时间
  beforeDestroy() {
    if (this.timer) {
      clearInterval(this.timer);
    }
  },
};
</script>

<style lang="less" scoped>
.el-button{
  position: fixed;
  right: 30px;
  bottom: 30%;
  box-shadow: 5px 5px 15px #e4e4e4;
  width: 60px;
  height:60px;
  border-radius: 50%;
  text-align: center;
  font-size: 16px;
  padding-left: 23px;
}
body {
  background-color: rgbc(248, 248, 248);
  font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
  font-size: 14px;
  margin: 0;
  padding: 0;
}
.swiper {
  position: relative;
  width: 100%;
  height: 500px;
  overflow: hidden;
}
.swiper-slide {
  text-align: center;
  font-size: 18px;
  background: #fff;

  /* Center slide text vertically */
  display: -webkit-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  -webkit-align-items: center;
  align-items: center;
}

.swiper-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.swiper-button-prev {
  background-image: url("./images/左-01.png");
}
.swiper-button-next {
  background-image: url("./images/右-01.png");
}
.container {
  .title {
    display: flex;
    align-items: center;
    height: 80px;
    font-size: 16px;
    .left {
      display: flex;
      width: 800px;
      height: 30px;
      border-right: 2px solid #e4e4e4;
      align-items: center;
      justify-content: space-around;
      color: rgb(130, 132, 130);
      .newGg {
        display: flex;
        align-items: center;
        justify-content: space-around;
        a {
          text-decoration: none;
          color: rgb(189, 154, 82);
          strong {
            color: black;
            font-weight: bold;
            font-size: 15px;
          }
        }
        i {
          display: inline-block;
          width: 30px;
          height: 30px;
          border-radius: 50%;
          background-color: rgb(189, 154, 82);
          text-align: center;
          line-height: 37px;
          img {
            width: 20px;
            height: 20px;
          }
          margin-right: 5px;
        }
      }
    }
    .right {
      flex: 1;
      height: 50px;
      color: red;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-left: 40px;
      font-size: 19px;
      .before {
        p {
          float: left;
        }
        img {
          width: 16px;
          height: 16px;
          margin: 0 10px;
        }
        span {
          font-size: 14px;
          color: rgb(130, 132, 130);
        }
      }
      .after {
        margin-right: 50px;
        span {
          font-size: 14px;
          color: rgb(130, 132, 130);
        }
      }
    }
  }
  .content {
    // background-color: #e4e4e4;
    border: 1px solid #e4e4e4;
    // box-shadow: 3px 3px 10px #e4e4e4;
    padding: 0 40px;
    height: 360px;
    .tite {
      display: flex;
      justify-content: space-between;
      align-items: center;
      height: 40px;
      font-size: 16px;
      // line-height: 40px;
      border-bottom: 1px solid #e4e4e4;
      padding: 10px 10px;
      color: rgb(189, 154, 82);
      .icon-anli {
        display: inline-block;
        font-size: 23px;
        color: rgb(189, 154, 82);
        vertical-align: middle;
        margin-right: 10px;
      }
      span:last-child {
        display: inline-block;
        font-size: 16px;
        cursor: pointer;
        margin-top: 1px;
      }
    }
    .bottom {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 30px;
      .box {
        width: 260px;
        height: 250px;
        box-shadow: 3px 3px 10px #e4e4e4;
        border: 1px solid #e4e4e4;
        overflow: hidden;
        transition: all 0.5s;
        padding:5px 6px;
        cursor: pointer;
        // &:hover img{
        //   transform: scale(1.1);
        // }
        &:hover {
          transform: scale(1.1);
          box-shadow: 3px 3px 10px 5px #e4e4e4;
        }
        img {
          width: 100%;
          height: 70%;
          transition: all 0.5s;
        }
        p {
          font-size: 16px;
          font-weight: bold;
          padding: 0 5px;
          margin-top: 10px;
        }

        p:last-child {
          padding: 0 5px;
          font-weight: 400;
          font-size: 14px;
          color: red;
          span {
            text-align: right;
            display: inline-block;
            width: 150px;
            color: rgb(189, 154, 82);
            em {
              display: inline-block;
              font-size: 18px;
              color: #e4e4e4;
              vertical-align: middle;
              margin-right: 5px;
            }
          }
        }
        span:last-child {
          // margin-top:px ;
          color: black;
        }
      }
    }
  }
}
</style>
